using System;
using System.Collections.Generic;
using System.ComponentModel;
using Microsoft.Ccr.Core;
using Microsoft.Dss.Core.Attributes;
using Microsoft.Dss.ServiceModel.Dssp;
using Microsoft.Dss.ServiceModel.DsspServiceBase;
using W3C.Soap;

namespace SimJaguar.Jaguar
{
    /// <summary>
    /// Jaguar contract class
    /// </summary>
    public sealed class Contract
    {
        /// <summary>
        /// DSS contract identifer for Jaguar
        /// </summary>
        [DataMember]
        public const string Identifier = "http://erobots.jcepeda.simjaguar/2011/09/simjaguar.html";
    }



    /// <summary>
    /// Jaguar main operations port
    /// </summary>
    [ServicePort]
    public class JaguarOperations : PortSet
        <
        DsspDefaultLookup,
        DsspDefaultDrop,
        Get,
        Replace,
        Subscribe,
        UpdateSuccessMsg>
    {
    }

    /// <summary>
    /// Jaguar get operation
    /// </summary>
    public class Get : Get<GetRequestType, PortSet<JaguarState, Fault>>
    {
        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        public Get()
        {
        }

        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        /// <param name="body">the request message body</param>
        public Get(GetRequestType body)
            : base(body)
        {
        }

        /// <summary>
        /// Creates a new instance of Get
        /// </summary>
        /// <param name="body">the request message body</param>
        /// <param name="responsePort">the response port for the request</param>
        public Get(GetRequestType body, PortSet<JaguarState, Fault> responsePort)
            : base(body, responsePort)
        {
        }
    }


    public class Replace : Replace<JaguarState, PortSet<DefaultReplaceResponseType, Fault>>
    {
        public Replace() { }

        public Replace(JaguarState body) : base(body) { }

        public Replace(JaguarState body, PortSet<DefaultReplaceResponseType, Fault> responsePort) : base(body, responsePort) { }

    }

    /// <summary>
    /// Jaguar subscribe operation
    /// </summary>
    public class Subscribe : Subscribe<SubscribeRequestType, PortSet<SubscribeResponseType, Fault>>
    {
        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        public Subscribe()
        {
        }

        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        /// <param name="body">the request message body</param>
        public Subscribe(SubscribeRequestType body)
            : base(body)
        {
        }

        /// <summary>
        /// Creates a new instance of Subscribe
        /// </summary>
        /// <param name="body">the request message body</param>
        /// <param name="responsePort">the response port for the request</param>
        public Subscribe(SubscribeRequestType body, PortSet<SubscribeResponseType, Fault> responsePort)
            : base(body, responsePort)
        {
        }
    }

    public class UpdateSuccessMsg : Update<UpdateSuccessMsgRequest, PortSet<DefaultReplaceResponseType, Fault>>
    {
    }

    [DataContract]
    public class UpdateSuccessMsgRequest
    {
        private double leftSpeed;
        private double rightSpeed;

        [DataMember]
        public double LeftSpeed
        {
            get { return leftSpeed; }
            set { leftSpeed = value; }
        }

        [DataMember]
        public double RightSpeed
        {
            get { return rightSpeed; }
            set { rightSpeed = value; }
        }
    }
}


